'use strict';

stareal
    .controller("RechargePaySuccessController", function ($scope, $api,$state,$alert,$stateParams,localStorageService) {
        $scope.failNum=false;
        var dataOrder=localStorageService.get("RepayPriceOrder");
        localStorageService.set("RepayPrice", 0);
        if(localStorageService.get('token')!=''&&localStorageService.get('token')!=null&&localStorageService.get('token')!=undefined) {
            if (dataOrder!= undefined &&dataOrder!= null && dataOrder!= '') {
                ///app/ShowcoinOrder/index/queryOrderIdStatus
                $api.get("app/ShowcoinOrder/index/queryOrderIdStatus", {orderId:dataOrder}, true)
                    .then(function (ret) {
                        var data = ret.data;
                        if (data.pay_status == 1){
                            $scope.failNum=false;
                            $scope.num=data.buy_num;
                        } else {
                            $scope.failNum=true;
                           $alert.show('支付失败');
                        }
                        // console.log(ret);
                    },function(err){
                        $alert.show(err);
                        $scope.failNum=true;
                    });
            }
            //
        }
    });